<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">

	<head>
<title><?php echo ($sys['sys_name']); ?></title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link href="/Public/Admin/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min.css?v=4.1" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/chosen/chosen.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/colorpicker/css/bootstrap-colorpicker.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/cropper/cropper.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/switchery/switchery.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/jasny/jasny-bootstrap.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/nouslider/jquery.nouislider.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">  
    <link href="/Public/Admin/css/style.min.css?v=4.0.0" rel="stylesheet">	
    <link href="/Public/Admin/css/uploadfile.css" rel="stylesheet">
   	<script src="/Public/Admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/Public/Common/layer/layer.js"></script>
    <script src="/Public/Admin/js/jquery.form.js"></script>
</head>

	<style>
.pages a,.pages span {
    display:inline-block;
    padding:4px 7px;
    margin:0 2px;
    border:1px solid #D5D4D4;
    -webkit-border-radius:1px;
    -moz-border-radius:1px;
    border-radius:1px;
}
.pages a,.pages li {
    display:inline-block;
    list-style: none;
    text-decoration:none; color:#077ee3;
}

.pages a:hover{
    border-color:#077ee3;
}
.pages span.current{
    background:#077ee3;
    color:#FFF;
    font-weight:700;
    border-color:#077ee3;
}

.long-tr th{
	text-align: center
}
.long-td td{
	text-align: center
}

</style>


	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">

		    <div id="wrapper">
        <!--左侧导航开始-->
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="nav-close"><i class="fa fa-times-circle"></i>
            </div>
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">
                        <div class="dropdown profile-element">
                            <span><img alt="image" class="img-circle" src="/Uploads/<?php echo ($_SESSION['admin_img']); ?>" onerror="this.src='/Public/Admin/img/touxiang_default.gif'" width="70px" height="70px"/></span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                               <span class="block m-t-xs"><strong><?php echo ($_SESSION['admin_realname']); ?></strong></span>
                                <span class="text-muted text-xs block">
                                    <?php echo ($admin_group["title"]); ?>
                                	<b class="caret"></b></span>
                                </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                <li><a href="<?php echo U('Sys/pwd');?>">修改密码</a></li>
                                <li><a href="javascript:;" id="cache">清除缓存</a></li>
                                <li><a href="<?php echo U('Sys/sys');?>">设置</a></li>
                                <li class="divider"></li>
                                <li><a href="javascript:;" id="logout">退出系统</a></li>
                            </ul>
                        </div>
                        <div class="logo-element">挪窝</div>
                    </li>
                    <li>
                        <a class="J_menuItem" href="<?php echo U(Index/index);?>"><i class="fa fa-home"></i> <span class="nav-label">主页</span>
                        <span class="label label-danger pull-right">NEW</span></a>
                    </li>

<?php use Common\Controller\AuthController; use Think\Auth; $m = M('auth_rule'); $field = 'id,name,title,css'; $data = $m->field($field)->where('pid=0 AND status=1')->order('sort')->select(); $auth = new Auth(); foreach ($data as $k=>$v){ if(!$auth->check($v['name'], $_SESSION['aid']) && $_SESSION['aid'] != 1){ unset($data[$k]); } } ?>

	<?php if(is_array($data)): foreach($data as $key=>$v): ?><li class="<?php if(CONTROLLER_NAME == $v['name']): ?>active<?php endif; ?>"><!--open代表打开状态-->
				<a href="#">
					<i class="menu-icon fa <?php echo ($v["css"]); ?>"></i>
					<span class="nav-label"><?php echo ($v["title"]); ?></span><span class="fa arrow"></span>
				</a>

			<ul class="nav nav-second-level">
    <?php $m = M('auth_rule'); $dataa = $m->where(array('pid'=>$v['id'],'status'=>1))->order('sort')->select(); foreach ($dataa as $kk=>$vv){ if(!$auth->check($vv['name'], $_SESSION['aid']) && $_SESSION['aid'] != 1){ unset($dataa[$kk]); } } ?>
		    <?php if(is_array($dataa)): foreach($dataa as $key=>$j): ?><li class=" <?php if(($_SESSION['se'] == $j['id'])): ?>active<?php endif; ?>">
						<a href="<?php echo U($j['name'],array('se'=>$j['id']));?>"><?php echo ($j["title"]); ?></a>						
					</li><?php endforeach; endif; ?>
			</ul>
		</li><?php endforeach; endif; ?>

        </ul>
    </div>
</nav>
<script type="text/javascript">
$(document).ready(function(){
    $("#logout").click(function(){
        layer.confirm('你确定要退出吗？', {icon: 3}, function(index){
        layer.close(index);
        window.location.href="<?php echo U('Login/logout');?>";
    });
    });
});



    $(function(){
        $("#cache").click(function(){
            layer.confirm('你确定要清除缓存吗？', {icon: 3}, function(index){
                layer.close(index);
                window.location.href="<?php echo U('Sys/clearRuntime');?>";
            });
        });
    });

    
</script>

    <div id="page-wrapper" class="gray-bg dashbard-1">
    <div class="row border-bottom">
	<nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
		<div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
			<form role="search" class="navbar-form-custom" method="post" action="search_results.html">
				<div class="form-group">
					<input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
				</div>
			</form>
		</div>
		<ul class="nav navbar-top-links navbar-right">
			<li>
				<span class="m-r-sm text-muted welcome-message">
					<a href="<?php echo U('Index/index');?>" title="返回首页"><i class="fa fa-home"></i></a>欢迎使用<?php echo ($sys['sys_name']); ?>
					<span class="label label-danger pull-right"><?php echo ($Os); ?></span>
				</span>
			</li>
			<!-- <li class="hidden-xs">
				<a href="http://tianjianlong.com.cn" class="J_menuItem" data-index="0"><i class="fa fa-cart-arrow-down"></i> 购买</a>
			</li> -->
			<li>
				<a href="javascript:;"  id="loginout">
					<i class="fa fa-sign-out"></i> 退出
				</a>
			</li>
		</ul>
	</nav>
</div>


<script type="text/javascript">
$(document).ready(function(){
	$("#loginout").click(function(){
		layer.confirm('你确定要退出吗？', {icon: 3}, function(index){
	    layer.close(index);
	    window.location.href="<?php echo U('Login/logout');?>";
	});
	});
});
</script>

		<div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-12">
                <h2>订单列表</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="<?php echo U('Index/index');?>"><i class="fa fa-home"></i> 主页</a>
                    </li>
                    <li>订单管理</li>
                    <li><strong>订单列表</strong></li>
                </ol>
            </div>
        </div>
        <br />
		<link rel="stylesheet" type="text/css" media="all" href="/Public/sldate/daterangepicker-bs3.css" />
		<script src="/Public/Admin/js/jquery.min.js"></script>
		<script type="text/javascript" src="/Public/sldate/moment.js"></script>
		<script type="text/javascript" src="/Public/sldate/daterangepicker.js"></script>
		<script type="text/javascript">
               $(document).ready(function() {
                  $('#reservation').daterangepicker(null, function(start, end, label) {
                    console.log(start.toISOString(), end.toISOString(), label);
                  });
               });
        </script>
        <div class="row">
			<div class="col-sm-12">
				<div class="col-sm-1">
					
							    </div>
			    <form name="admin_list_sea" class="form-search" method="post" action="/nw.php/Order/index">
					<div  class="col-sm-2">
						<div class="input-group" style="width: 240px">
						<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
							<input type="text" class="form-control" name="reservation" id="reservation" class="sl-date" value="<?php echo ($s); ?>" placeholder="点击选择创建时间范围"/>
						</div>
					</div>
					<div class="col-sm-3">
						<div class="input-group">
							<input type="text" name="key" id="key" class="form-control" value="<?php echo ($val); ?>" placeholder="输入需查询的出发地或者目的第" />
							<span class="input-group-btn">
				            	<button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
				            </span>
						</div>
					</div>
				</form>
				<!--导出全部订单-->
				<!-- <div class="input-group">
							            <a href="/nw.php/Order/index/export_excel/1" class="btn btn-primary">导出订单表</a>
							        </div> -->
				<div class="input-group">
									<button type="button" class="btn btn-primary" id="export_excel"><i class="fa fa-arrow-circle-right"></i>导出订单表</button>
							            <!-- <a href="/nw.php/Order/index/export_excel/1" class="btn btn-primary">导出订单表</a> -->
							        </div>
			</div>
		</div>

		<br />
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5><i class="fa fa-tasks"></i> 用户列表</h5>
					</div>
					<div class="ibox-content">
					<form id="leftnav" name="leftnav" method="post" action="" >
                    <input type="hidden" name="checkk" id="checkk" value="1" />

						<table class="table table-bordered">
							<thead>
								<tr class="long-tr">
									<th width="3%">ID</th>
									<th width="3%">城市</th>
									<th width="8%">出发地</th>
									<th width="8%">目的地</th>
									<th width="3%">距离</th>
									<th width="5%">订单号</th>
									<th width="8%">创建时间</th>
									<th width="8%">预定时间</th>
									<th width="3%">车辆信息</th>
									<th width="3%">姓名</th>
									<th width="6%">手机号</th>
									<th width="3%">总費用</th>
									<th width="3%">车费</th>
									<th width="3%">搬运费</th>
									<th width="3%">行李件数</th>
									<th width="3%">大件家具</th>
									<th width="5%">状态</th>
									<th width="5%">备注</th>
									<th width="5%">一人搬运备注</th>
									<th width="5%">两人搬运备注</th>
									<th width="5%">支付状态</th>
									<th width="5%">操作</th>
								</tr>
							</thead>
							<script id="arlist" type="text/html">
								{{# for(var i=0;i<d.length;i++){  }}

								<tr class="long-td">
								  	<td>{{d[i].id}}</td>
									<td>{{d[i].getcity}}</td>
									<td>{{d[i].startadd}}</td>
									<td>{{d[i].endadd}}</td>
									<td>{{d[i].distance}}</td>
									<td>{{d[i].orderno}}</td>
									<td>{{d[i].ctime}}</td>
									<td>{{d[i].time}}</td>
									<td>{{d[i].car}}</td>
									<td>{{d[i].name}}</td>
									<td>{{d[i].mphone}}</td>
									<td>{{d[i].cost}}</td>
									<td>{{d[i].car_fee}}</td>
									<td>{{d[i].costfb}}</td>
									<td>{{d[i].bag_num}}</td>
									<td>{{d[i].items}}</td>
									<td>
										{{# if(d[i].status==2){ }}
											回复信息：{{d[i].reply}}
										{{# }else if(d[i].status==1){ }}
											<div id="zt{{d[i].id}}"><span class="label label-danger">未处理</span></div>
								  		{{# }else{ }}
											
												<div id="zt{{d[i].id}}"><span class="label label-danger">待回复</span></div>
											
								  		{{# } }}
									</td>
									<td>{{d[i].beizhu}}</td>
									<td>{{d[i].bei1}}</td>
									<td>{{d[i].bei2}}</td>
										<td>
											{{# if(d[i].paystatus==1){ }}
											<span class="label label-success">已支付</span>
								  		{{# }else{ }}
											<span class="label label-danger">未支付</span>
								  		{{# } }}
										</td>
									<td>

									{{# if(d[i].status==2){ }}
											
													<a href="javascript:;" onclick="del({{d[i].id}})" class="btn btn-danger btn-xs">
											<i class="fa fa-trash-o"></i> 删除</a>
												{{# if(d[i].pinglunstatus==1){ }}
											<span class="label label-success">已评价</span>
											{{# }else if(d[i].pinglunstatus==2){ }}
											<span class="label label-default">已推送</span>
											<a href="javascript:;" onclick="pinglun({{d[i].id}})" class="btn btn-info btn-xs">
											<i class="fa fa-paper-plane-o"></i>继续推送评价</a>
								  		{{# }else{ }}
											 <a href="javascript:;" onclick="pinglun({{d[i].id}})" class="btn btn-info btn-xs">
											<i class="fa fa-paper-plane-o"></i>推送评价</a>
								  		{{# } }}



												
												
								  		{{# }else{ }}
											
												<a href="javascript:;" onclick="edit({{d[i].id}})" class="btn btn-primary btn-xs">
											<i class="fa fa-paste"></i> 回复</a>&nbsp;&nbsp;
										<a href="javascript:;" onclick="del({{d[i].id}})" class="btn btn-danger btn-xs">
											<i class="fa fa-trash-o"></i> 删除</a>
										
											
								  		{{# } }}


										
									</td>
								</tr>
								{{# } }}
							</script>
							<tbody id="article_list"></tbody>

						</table>

					</form>

					<div id="AjaxPage" style=" text-align: right;"></div>
					<div id="allpage" style=" text-align: right;"></div>
					<div class="pages" style=" text-align: right;">
							<div>  <span class="current">1</span>  </div>						</div>
					</div>
				</div>
			</div>
		</div>
	<script type="text/javascript" src="/Public/Common/laytpl/laytpl.js"></script>
	<script type="text/javascript" src="/Public/Common/laypage/laypage.js"></script>
	<div class="footer" style="position: fixed;z-index: 999;bottom: 0;width: 89%;">
	<div class="pull-right"><?php echo ($sys['sys_name']); ?> Copyright © 2016</div>
</div>
</div>
</div>
<script type="text/javascript" src="/Public/Admin/js/bootstrap.min.js?v=3.3.5"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="/Public/Admin/js/hplus.min.js?v=4.0.0"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/switchery/switchery.js"></script>
<script type="text/javascript" src="/Public/Admin/js/contabs.min.js"></script>
<script type="text/javascript" src="/Public/Common/laydate/laydate.js"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/pace/pace.min.js"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/chosen/chosen.jquery.js"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/iCheck/icheck.min.js"></script>
<script type="text/javascript" src="/Public/Admin/js/plugins/sweetalert/sweetalert.min.js"></script>

<script>
    $(document).ready(function(){$(".i-checks").iCheck({checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",})});
</script>


	<script type="text/javascript">
	//laypage分页
	function Ajaxpage(curr){
		var key=$('#key').val();//搜索关键字
		var reservation=$('#reservation').val();//日期
		$.get('<?php echo U("Order/index");?>', {
	        page: curr || 1,key:key,reservation:reservation
	    }, function(data){
			if(data.list=null){
				$("#article_list").html('<center style="margin-top:300px;font-size:15px;">没有数据</center>');
			}else{
				article_list(data.info);
				laypage({
					cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
					pages:'<?php echo ($allpage); ?>',//总页数
					skip: true,//是否开启跳页
					skin: '#1AB5B7',
					curr: curr || 1,
					groups: 4,//连续显示分页数
					jump: function(obj, first){

						if(!first){
							Ajaxpage(obj.curr)
						}
						$('#allpage').html('第'+ obj.curr +'页，共'+ obj.pages +'页');
					}
				});
			}
		});
	}
	Ajaxpage();

//接收异步获取的数据渲染到模板
function article_list(list){
	var tpl = document.getElementById('arlist').innerHTML;
	laytpl(tpl).render(list, function(html){
		document.getElementById('article_list').innerHTML = html;
	});
}

//状态



//编辑
function edit(id){

	location.href = '/nw.php/Order/edit/id/'+id+'.html';
}

//删除
function del(id){

	layer.confirm('你确定要删除吗？', {icon: 3}, function(index){
		layer.close(index);
		$.ajax({
			url : "<?php echo U('Order/del');?>",
			type : "post",
			data:{id:id},
			success : function(res) {
				if(res.status) {
					layer.msg(res.info,{icon:1,time:1000});
					Ajaxpage(1,5)
				} else {
					layer.msg(res.info,{icon:0});
				}
			}
		});
	});

}
function pinglun(id){

	url = '/nw.php/Order/tui_pinglun';
	$.post( url, {
				id:id,
				type:'carry',

		    }, function(data, status) {
		    	var obj = eval('('+data+')'); 
		    	//console.log(data);
		    	if (obj.errmsg=='ok') {
		    	layer.alert('推送成功');
		    	}else{
		    	layer.alert('推送失败');
		    	}
		    	Ajaxpage(1);
		    });


}

$('#export_excel').click(function(){
	var key=$('#key').val();//搜索关键字
		var reservation=$('#reservation').val();//日期

url = '/nw.php/Order/index?key='+key+'&reservation='+reservation+'&export_excel=1';
	location.href=url;

})

</script>

	</body>

</html>